package a_airwar;


public class Bee extends FlyObj implements Award {
    private int speedx;
    private int speedy;
    private int awardType=(int)(Math.random()*2);  //奖励的类型 0/1
    /* public Bee() {
         image = JFrameMain.bee;
         width = image.getWidth();
         height = image.getHeight();
         x = (int) (Math.random() * JFrameMain.Width);
         y = -image.getHeight();
         speed = 5;
         blood = 2;
         index = 0;
         speed_1 = 3;
     }*/

    public Bee() {
        //使用private修饰之后 所有的成员变量都访问不到
        //只能使用super关键词调用 - 调用父类的构造方法
        super((int) (Math.random() * JFrameMain.Width),
                -JFrameMain.bee.getHeight(),
                JFrameMain.bee,
                3);
        speedx = 5;
        speedy = 3;
    }

    @Override
    public void move() {
     /*   x -= speed;
        y += speed_1;
        if (x >= JFrameMain.Width - JFrameMain.bee.getWidth()) {
            speed = -speed;
        } else if (x <= 0) {
            speed = -speed;
        }*/

        this.setX(this.getX() + speedx);
        this.setY(this.getY() + speedy);
        if (this.getX() >= JFrameMain.Width - JFrameMain.bee.getWidth()) {
            speedx = -speedx;
        } else if (this.getX() <= 0) {
            speedx = -speedx;
        }
    }


    @Override
    public int getType() {
        return awardType;
    }




}
